<template>
	<view class="container">
		<u--text color='#686868' :text="'共'+records+'位分享好友'"></u--text>
		<view class="u-page" v-if="users.length>0">
				<u-list
					 
				>
					<u-list-item
						v-for="(item, index) in users"
						:key="index"
					>
						<u-cell
							:title="item.real_name"
						>
							<u-avatar
								slot="icon"
								shape="square"
								size="35"
								:src="item.avatar"
								customStyle="margin: -3px 5px -3px 0"
							></u-avatar>
						</u-cell>
					</u-list-item>
				</u-list>
			</view>
		<u--text color='#a7a7a7' class="u-m-t-20" text='【分享有礼活动说明】:从【有礼分享】等页面,分享个好友,若对方为首次使用,点击体验后即可成为你邀请的好友.若好友购买,您将分享对应提成收益'></u--text>
		<u--text class="u-m-t-80" color='#D80303' text='若你是【付费用户且在有效期内】,根据您本人的版本享受不同比例提成,产生的收益,将在每个月初10号前,结算上个月提成,由客服微信转账给您!具体提成规则为:'></u--text>
		<u--text class="u-m-t-20" color='#D80303' text='1.微店版付费用户,享受好友购买金额的10%'></u--text>
		<u--text class="u-m-t-20" color='#D80303' text='2.单店版付费用户,享受好友购买金额的15%'></u--text>
		<u--text class="u-m-t-20" color='#D80303' text='3.连锁版付费用户,享受好友购买金额的20%'></u--text>
		<u--text class="u-m-t-80" color='#D80303' text='注意: 免费用户不享受现金分成,但可享受微店版使用权益,每分享3个新用户可兑换一个月会员权益,联系客服兑换'></u--text>
	</view>
</template>

<script>
	var that
		import mInit from "../../../tools/Init"
		var UserInfo = require('../../../service/UserInfo.js'), mUserInfo;
	export default {
		data() {
			return {
				userInfo:{},
				records:0,
				users:[]
			}
		},
		onLoad() {
			that = this
			mUserInfo = new UserInfo(this.mNetTool)
			mInit.init(this.mNetTool, res => {
				let userInfo = uni.getStorageSync('userInfo')
				if(userInfo){
					that.userInfo = userInfo
				}
				 
				this.loadData();
			})  
		},
		methods: {
			loadData(){
				if(this.userInfo.id){
					console.log(this.userInfo.id + ' ')
					 
					mUserInfo.list({
						invited_by:this.userInfo.id
					},res => {
						console.log(res)
						 that.records = res.records
						 that.users = res.rows
					})
					// that.mNetTool.getAjaxUrlValueBackground('capi/V2/ERShareGift/erShareGift/list',{
					// 	promoter_id:this.userInfo.id
					// },res => {
					// 	 that.records = res.records
					// })
				}
			}
		}
	}
</script>

<style lang="scss">
	.container {
		padding: 0 32rpx;
	}
</style>
